<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        function Person(name, age, gender) {
            this.name = name;
            this.age = age;
            this.gender = gender;
        }
        var per = new Person("孙悟空", 18, "男");
        // 当我们直接在页面中打印一个对象时，事件上时输出的对象的toString()方法的返回值
        // var result = per.toString();
        // console.log(result);

        // per.toString = function() {
        //     return "Person[name+'this.name+',age='this.age+',gender='+this.gender']"
        // };
        console.log(per);
    </script>
</body>

</html>